package edu.sctu.zhengsenwen.month201506.day20150616.network;


import java.net.MalformedURLException;
import java.net.URL;

/**
 * 显示URL类的属性的实例
 * Created by user15 on 2015/6/17.
 */
public class ShowURLProperties {


    public static void main(String[] args) throws MalformedURLException {

//        URL url = new URL("http://javamsun.com:80/j2ss/1.5.0/docs/index.html#notes");

        URL url = new URL("https://www.baidu.com");


        //URL类的属性
        System.out.println("协议= "+url.getProtocol());
        System.out.println("主机= "+url.getHost());
        System.out.println("文件名 = "+url.getFile());
        System.out.println("接口 ="+url.getPort());
        System.out.println("引用 ="+url.getRef());
        System.out.println("路径 ="+url.getPath());

    }
}
